<script setup>
const name = 'zs'

const sayHi = () => {
    console.log('你好' + name);
}

// 父组件想使用子组件的方法，需要子组件主动暴露 defineExpose
defineExpose({
    name,
    sayHi
})
</script>

<template>
    <h1>我是子组件</h1>
</template>
